*THIS FILE GENERATES VARIABLES FOR ANALYSIS OF PUBLIC GOODS GAMES

use "Public Goods Games.dta", clear


sort playercode round
xtset playercode round

gen SewaMem = (type=="T1")
label var SewaMem "SEWA member, SEWA village"
gen SewaVNonMem = (type=="T2")
label var SewaVNonMem "Non-member, SEWA village"

gen noeduc = (education==0)
label var noeduc "No formal education"

gen age2 = age^2

encode married, gen(mcode)
tab mcode, gen(mar_)

generate LNet=L.net 
label var LNet "Lagged net contribution"
generate SewaMemXLNet=SewaMem*LNet
label var SewaMemXLNet "SEWA Member x Lagged net contribution"
generate SewaVNonMemXLNet=SewaVNonMem*LNet 
label var SewaVNonMemXLNet "SEWA Village Non-Member x Lagged net contribution"

tab round, gen(r_)
tab village, gen(v_)
tab day, gen(d_)

gen SewaV = 0
replace SewaV = 1 if type=="T1"|type=="T2"

gen SewaVXLNet = SewaV*LNet

gen SewaVill = 0
replace SewaVill = 1 if village=="Doongar"
replace SewaVill = 1 if village=="Gamra Barmaniya"
replace SewaVill = 1 if village=="Hadmatia"
replace SewaVill = 1 if village=="Kesarpura"
replace SewaVill = 1 if village=="Lorwara"
replace SewaVill = 1 if village=="Sablana"
replace SewaVill = 1 if village=="Undrada"
